var t = getApp();

Page({
    data: {
        link_url: "",
        list: [],
        isLoadMore: !0,
        page: 1,
        total_page: 0,
        tag: ""
    },
    onLoad: function(t) {
        t.tag && this.setData({
            tag: t.tag
        }), this.initData(), this.getData();
    },
    getData: function() {
        var a = this, i = t.getNetAddresss(this.data.link_url);
        t._postNetWork({
            url: i,
            showToastIn: !1,
            data: {
                page: this.data.page
            },
            success: function(t) {
                var i = t.data;
                if (1 == i.result) {
                    var s = i.data;
                    a.setData({
                        list: s.data,
                        page: s.current_page,
                        total_page: s.last_page
                    });
                } else wx.showToast({
                    icon: "none",
                    title: i.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    _getMoreData: function() {
        var a = this, i = {
            page: this.data.page
        }, s = this.data.link_url, n = "";
        a.data.isLoadMore = !1, this.data.page >= this.data.total_page || (this.data.page = this.data.page + 1, 
        n = t.getNetAddresss(s), t._postNetWork({
            url: n,
            showToastIn: !1,
            data: i,
            success: function(t) {
                var i = t.data;
                if (1 == i.result) {
                    var s = i.data.data;
                    a.setData({
                        isLoadMore: !0,
                        list: a.data.list.concat(s)
                    });
                } else a.setData({
                    page: a.data.page - 1,
                    isLoadMore: !1
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        }));
    },
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {},
    initData: function() {
        1 == this.data.tag ? this.data.link_url = "plugin.commission-activity.api.dividend-list.estimate" : 2 == this.data.tag ? this.data.link_url = "plugin.commission-activity.api.dividend-list.unsettlement" : 3 == this.data.tag ? this.data.link_url = "plugin.commission-activity.api.dividend-list.settlement" : 4 == this.data.tag ? this.data.link_url = "plugin.commission-activity.api.dividend-list.nowithdraw" : 5 == this.data.tag ? this.data.link_url = "plugin.commission-activity.api.dividend-list.withdraw" : 6 == this.data.tag && (this.data.link_url = "plugin.commission-activity.api.dividend-list.failure");
    }
});